package com.chao.juc.lock;

/**
 * @author : Rookie
 * @description :
 * @date : 2022/1/9
 */
public class SaleTicketDemo1 {
    public static void main(String[] args) {

        //把资源类丢入线程
        Ticket ticket = new Ticket();

        new Thread(() ->{
            for (int i = 1; i < 60; i++) {
                ticket.sale();
            }
        },"A").start();

        new Thread(() ->{
            for (int i = 1; i < 60; i++) {
                ticket.sale();
            }
        },"B").start();

        new Thread(() ->{
            for (int i = 1; i < 60; i++) {
                ticket.sale();
            }
        },"C").start();
    }
}
